//
//  YSCoverFlowView.h
//  YSCoverFlowView
//
//  Created by yueshi－mac1 on 15/12/2.
//  Copyright © 2015年 悦食中国. All rights reserved.
//

#import <UIKit/UIKit.h>

typedef enum{
    CoverFlowViewOrientationHorizontal = 0,
    CoverFlowViewOrientationVertical
}CoverFlowViewOrientation;

typedef enum {
    PageDirectionPrevious = 0,
    PageDirectionDown
} PageDirectionE;

@protocol YSCoverFlowViewDataSource;
@protocol YSCoverFlowViewDelegate;

@interface YSCoverFlowView : UIView<UIScrollViewDelegate>

@property (nonatomic, weak) id <YSCoverFlowViewDataSource> dataSource;
@property (nonatomic, weak) id <YSCoverFlowViewDelegate>   delegate;
//@property (nonatomic, strong) UIImageView         *defaultImageView;
@property (nonatomic, assign) CoverFlowViewOrientation orientation;
@property (nonatomic, assign, readonly) NSInteger currentPageIndex;

@property (nonatomic, assign) CGFloat marginTop;
//default is 1.0
@property (nonatomic, assign) CGFloat minimumPageAlpha;
//default is 1.0
@property (nonatomic, assign) CGFloat minimumPageScale;

- (void)reloadData;
- (UIView *)dequeueReusableCell;
- (UIView *)cellForItemAtCurrentIndex:(NSInteger)currentIndex;

- (void)scrollToNextPage;

@end

@protocol  YSCoverFlowViewDelegate<NSObject>
- (void)didReloadData:(UIView *)cell cellForPageAtIndex:(NSInteger)index;

@optional
- (void)didScrollToPage:(NSInteger)pageNumber inCoverFlowView:(YSCoverFlowView *)coverFlowView;
- (void)didSelectItemAtIndex:(NSInteger)index inCoverFlowView:(YSCoverFlowView *)coverFlowView;

@end


@protocol YSCoverFlowViewDataSource <NSObject>

// Return the number of views.
- (NSInteger)numberOfPagesInCoverFlowView:(YSCoverFlowView *)coverFlowView;
- (CGSize)sizeForPageInCoverFlowView:(YSCoverFlowView *)coverFlowView;

// Reusable cells
- (UIView *)coverFlowView:(YSCoverFlowView *)coverFlowView cellForPageAtIndex:(NSInteger)index;

@end
